/*
static JSBool
Curl$open(JSContext *cx, uintN argc, jsval *vp) {
	trace1("curl_open");
	struct T *x = (struct T *)JS_GetPrivate(cx, JS_THIS_OBJECT(cx, vp));
	if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "ss", &x->method, &x->url))
		return JS_FALSE;
	x->chunk.memory = (char *)malloc(1);	
	x->chunk.size = 0;
	x->curl = curl_easy_init();
	if(!x->curl) {
		JS_ReportError(cx, "curl: cannot initialize.");
		return JS_FALSE;	
	}
	curl_easy_setopt(x->curl, CURLOPT_URL, x->url);
	curl_easy_setopt(x->curl, CURLOPT_NOPROGRESS, 1);	
	curl_easy_setopt(x->curl, CURLOPT_TIMEOUT, 1);
	curl_easy_setopt(x->curl, CURLOPT_TCP_NODELAY, 1);
	curl_easy_setopt(x->curl, CURLOPT_AUTOREFERER, 1);
	curl_easy_setopt(x->curl, CURLOPT_FOLLOWLOCATION, 1);
	curl_easy_setopt(x->curl, CURLOPT_MAXREDIRS, 10);
	curl_easy_setopt(x->curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);	
	curl_easy_setopt(x->curl, CURLOPT_WRITEDATA, (void *)&x->chunk);
	curl_easy_setopt(x->curl, CURLOPT_USERAGENT, "curl");
	x->readyState = 1;	
	JS_SET_RVAL(cx, vp, JSVAL_VOID);
	return JS_TRUE;
}
*/


/*
static JSBool
Curl$send(JSContext *cx, uintN argc, jsval *vp) {
	trace1("Curl_send");
	struct T *x = (struct T *)JS_GetPrivate(cx, JS_THIS_OBJECT(cx, vp));
	trace2("x->readyState = %d", x->readyState);
	if(x->readyState != 1) {
		JS_ReportError(cx, "Curl: not initialized.");
		return JS_FALSE;
	}
	char *data;
	if(JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "s", &data)) {
		curl_easy_setopt(x->curl, CURLOPT_POST, 1);
		curl_easy_setopt(x->curl, CURLOPT_POSTFIELDS, data);
	}
	x->readyState = 2;
	jsrefcount rc = JS_SuspendRequest(cx);
	CURLcode res = curl_easy_perform(x->curl);
	JS_ResumeRequest(cx, rc);
	JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, x->chunk.memory)));
	x->readyState = 4;
	curl_easy_cleanup(x->curl);
	if(x->chunk.memory)
		free(x->chunk.memory);
	return JS_TRUE;
}
*/
